package BaseTest

import scala.collection.mutable

object SetDemo {
  def main(args: Array[String]): Unit = {
    val s1 = new mutable.HashSet[String]
    s1 += "A"
    s1 ++= Set("B", "C", "D")

    println(s1)


    // LinkedHashSet是有序的，按照添加元素的顺序排序
    val ls = new mutable.LinkedHashSet[Int]
    ls += 1
    println(ls)


    //可排序的Set
    val ts = new mutable.TreeSet[Int]()

    ts.add(10)
    ts += 3
    ts += 5
    ts += 5
    ts ++= Set(4, 7, 9, 4, 4, 5, 67, 89, 10)
    println(ts)

  }
}
